# class Solution(object):
#     def closestDivisors(self, num):
#         def find(num):
#             base = num ** 0.5
#             if int(base) == base:
#                 return [int(base), int(base)]
#             left = int(base)
#             right = int(base) + 1
#             while left * right != num:
#                 print(left, right)
#                 if left * right < num:
#                     right += 1
#                 else:
#                     left -= 1
#             return [left, right]
#
#         out1 = find(num + 1)
#         out2 = find(num + 2)
#         if out1[1] - out1[0] < out2[1] - out2[0]:
#             return out1
#         else:
#             return out2

class Solution(object):
    def closestDivisors(self, num):
        def find(num):
            base = int(num ** 0.5)
            if base ** 2 == num:
                return [base, base]
            else:
                for k in range(base, 0, -1):
                    if num % k == 0:
                        return [k, num // k]

        out1 = find(num + 1)
        out2 = find(num + 2)
        if out1[1] - out1[0] < out2[1] - out2[0]:
            return out1
        else:
            return out2

data = Solution()
num = 688427155
print(data.closestDivisors(num))
